package dhy.lyb.change.dao;

import dhy.lyb.change.model.Activity;
import dhy.lyb.change.model.Food;
import dhy.lyb.change.model.User;
import dhy.lyb.change.model.UserActivity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by Administrator on 2016/11/18.
 */
public interface UserDao extends BaseDao<User> {

    /**
     * 登录检查
     *
     * @param user
     * @return
     */
    public User getUserByPassword(User user);

    /**
     * 修改密码
     *
     * @param user
     * @return
     */
    public int updatePasswordByMobile(User user);

    /**
     * 获取用户列表（废弃）
     *
     * @return
     */
    public List<User> getUserActivityList();

    /**
     * 获取单个用户信息（包含已经选择的训练项目）
     *
     * @param user
     * @return
     */
    public User getUserActivityById(User user);

    /**
     * 添加用户与训练项目的关联
     *
     * @param user
     * @return
     */
    public int insertUserActivity(@Param("user") User user, @Param("activity") Activity activity);

    /**
     * 删除用户与训练项目的关联
     *
     * @param user
     * @param activity
     * @return
     */
    public int deleteUserActivity(@Param("user") User user, @Param("activity") Activity activity);

    /**
     * 添加用户与食谱
     *
     * @param user
     * @return
     */
    public int insertUserFood(@Param("user") User user, @Param("food") Food food);

    /**
     * 删除用户与食谱的关联
     *
     * @param user
     * @param food
     * @return
     */
    public int deleteUserFood(@Param("user") User user, @Param("food") Food food);

    /**
     * 更新训练项目的信息
     *
     * @param userActivity
     * @return
     */
    public int updateUserActivityUses(UserActivity userActivity);

    /**
     * 检查用户是否有训练的项目
     *
     * @param user_id
     * @return
     */
    public int checkUserActivity(@Param("user_id") Integer user_id);
}
